package com.generator.base;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.generator.util.PreUtils;
import org.springframework.validation.annotation.Validated;

/**
 * 业务封装基础类
 *
 * @param <M> mapper
 * @param <T> model
 * @author
 */
@Validated
public class BaseServiceImpl<M extends BaseMapper<T>, T extends BaseEntity> extends ServiceImpl<M, T> implements BaseService<T> {

    private Class<T> modelClass;

    @Override
    public boolean save(T entity) {
        PreUtils.preSave(entity);
        return super.save(entity);
    }

    @Override
    public boolean updateById(T entity) {
        PreUtils.preUpdate(entity);
        return super.updateById(entity);
    }


}
